package com.asset.dispoal.department.service.commom;

import com.asset.dispoal.department.domain.db.mapper.SysDepartmentMapper;
import com.asset.dispoal.department.dto.DepartmentRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/1/27$
 */
@Component
public class DepartmentDeleteCommand implements BaseCommand<DepartmentRequest, Result> {

    @Autowired
    SysDepartmentMapper sysDepartmentMapper;

    @Override
    public Result execute(DepartmentRequest request) {
        sysDepartmentMapper.delete(request.getId());
        return Result.ok();
    }
}
